package com.qk.management.mapper;

import com.qk.entity.Role;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Author: chouh
 * @DateTime: 2025/10/8 19:57
 * @Description:
 */

@Mapper
public interface RoleMapper {

    @Select("select * from role where id = #{roleId}")
    Role selectById(Integer roleId);

    @Select("select * from role")
    List<Role> queryAllRoles();

    @Update("update role set name = #{name},label = #{label},remark = #{remark},update_time = #{updateTime} where id = #{id}")
    void updateRole(Role role);

    @Select("select * from role where id = #{id}")
    Role queryRoleById(Integer id);

    @Insert("insert into role(name,label,remark,create_time,update_time) values(#{name},#{label},#{remark},#{createTime},#{updateTime})")
    void insertRole(Role role);

    @Delete("delete from role where id = #{id}")
    void deleteRole(Integer id);

    Integer count(@Param("name") String name,
                  @Param("label") String label);

    List<Role> selectByPage(@Param("name") String name,
                            @Param("label") String label,
                            @Param("offset") Integer offset,
                            @Param("pageSize") Integer pageSize
    );
}
